package com.jy.appmarket.screenlock.adapter;

import java.util.List;

import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;

import com.android.corestat.utils.LogUtil;

/** 
 * 类说明：   
 * @author  kalui.huang
 * @date    2015-3-9
 * @version 1.0
 */
public class CustomPagerAdapter extends PagerAdapter {
	public List<View> mViewList;

	public CustomPagerAdapter(List<View> mListViews) {
		this.mViewList = mListViews;
	}

	@Override
	public void destroyItem(View arg0, int arg1, Object arg2) {
		((ViewPager) arg0).removeView(mViewList.get(arg1));
	}

	@Override
	public void finishUpdate(View arg0) {
	}

	@Override
	public int getCount() {
		return mViewList.size();
	}

	@Override
	public Object instantiateItem(View arg0, int arg1) {
		LogUtil.i("customBanners", "instantiateItem position:" + arg1);
		View view = mViewList.get(arg1);
		((ViewPager) arg0).addView(view, 0);
		return view;
	}

	@Override
	public boolean isViewFromObject(View arg0, Object arg1) {
		return arg0 == (arg1);
	}

	@Override
	public void restoreState(Parcelable arg0, ClassLoader arg1) {
	}

	@Override
	public Parcelable saveState() {
		return null;
	}

	@Override
	public void startUpdate(View arg0) {
	}
}